package com.xmu.prcs.entity;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.Index;
/**
 * 植物表
 * @author frequent
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "plant", uniqueConstraints = {
		@UniqueConstraint(columnNames = "plantname"),
		@UniqueConstraint(columnNames = "scientificname") })
@org.hibernate.annotations.Table(appliesTo = "plant",
        indexes = {@Index(name = "idxPUT", columnNames = {"uploadtime"}),
			@Index(name = "idxPPN", columnNames = {"plantname"})})
public class Plant implements java.io.Serializable{
	
	private Integer idPlant;
	private String plantName;//植物名
	private String scientificName;//学名
	private String englishName;//英文名
	private String alias;//别名
	private String characteristic;//形态特征
	private String originPlace; //产地
	private String habits; //习性
	private String growPoint; //培育要点
	private String application; //用途
	private String culture; //文化历史
	private String campus; //校园分布
	private Date uploadTime; //上传时间
	private Set<Location> locations;//植物地理位置
	private Set<Image> images;//植物图片
	private String kindKe;//所属的科
	private String kindShu;//所属的属
	private String subjectName;//主题名
	
	public Plant(){
		
	}
	
	public Plant(String plantName, String scientificName, String alias,
			String characteristic, String originPlace, String habits,
			String growPoint, String application,String culture, Date uploadTime){
		this.plantName = plantName;
		this.scientificName = scientificName;
		this.alias = alias;
		this.characteristic = characteristic;
		this.originPlace = originPlace;
		this.habits = habits;
		this.growPoint = growPoint;
		this.application = application;
		this.culture = culture;
		this.uploadTime = uploadTime;
	}

	@Id
	@GeneratedValue
	@Column(name = "idplant", unique = true, nullable = true)
	public Integer getIdPlant() {
		return idPlant;
	}

	public void setIdPlant(Integer idPlant) {
		this.idPlant = idPlant;
	}

	@Column(name = "plantname", length = 20)
	public String getPlantName() {
		return plantName;
	}

	public void setPlantName(String plantName) {
		this.plantName = plantName;
	}

	@Column(name = "scientificname", length = 40)
	public String getScientificName() {
		return scientificName;
	}

	public void setScientificName(String scientificName) {
		this.scientificName = scientificName;
	}

	@Column(name = "englishName", length = 40)
	public String getEnglishName() {
		return englishName;
	}

	public void setEnglishName(String englishName) {
		this.englishName = englishName;
	}

	@Column(name = "alias", length = 20)
	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	@Column(name = "characteristic", length = 500)
	public String getCharacteristic() {
		return characteristic;
	}

	public void setCharacteristic(String characteristic) {
		this.characteristic = characteristic;
	}

	@Column(name = "originplace", length = 200)
	public String getOriginPlace() {
		return originPlace;
	}

	public void setOriginPlace(String originPlace) {
		this.originPlace = originPlace;
	}

	@Column(name = "habits", length = 200)
	public String getHabits() {
		return habits;
	}

	public void setHabits(String habits) {
		this.habits = habits;
	}

	@Column(name = "growpoint", length = 200)
	public String getGrowPoint() {
		return growPoint;
	}

	public void setGrowPoint(String growPoint) {
		this.growPoint = growPoint;
	}

	@Column(name = "application", length = 200)
	public String getApplication() {
		return application;
	}

	public void setApplication(String application) {
		this.application = application;
	}

	@Column(name = "culture", length = 200)
	public String getCulture() {
		return culture;
	}

	public void setCulture(String culture) {
		this.culture = culture;
	}

	@Column(name = "campus", length = 200)
	public String getCampus() {
		return campus;
	}

	public void setCampus(String campus) {
		this.campus = campus;
	}

	@Column(name = "uploadtime")
	public Date getUploadTime() {
		return uploadTime;
	}

	public void setUploadTime(Date uploadTime) {
		this.uploadTime = uploadTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = "idplant")
	public Set<Image> getImages() {
		return images;
	}

	public void setImages(Set<Image> images) {
		this.images = images;
	}

	@Column(name = "kindke", length = 10)
	public String getKindKe() {
		return kindKe;
	}

	public void setKindKe(String kindKe) {
		this.kindKe = kindKe;
	}

	@Column(name = "kindshu", length = 10)
	public String getKindShu() {
		return kindShu;
	}

	public void setKindShu(String kindShu) {
		this.kindShu = kindShu;
	}

	@Column(name = "subjectname", length = 10)
	public String getSubjectName() {
		return subjectName;
	}

	public void setSubjectName(String subjectName) {
		this.subjectName = subjectName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = "idplant")
	public Set<Location> getLocations() {
		return locations;
	}

	public void setLocations(Set<Location> locations) {
		this.locations = locations;
	}
}
